<!DOCTYPE html>
<!--
This is a starter template page. Use this page to start your new project from
scratch. This page gets rid of all links and provides the needed markup only.
-->
<html lang="en">

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta http-equiv="x-ua-compatible" content="ie=edge">
  <title><%=SETTING.website_name%></title>
  <%- include(VIEWROOT+'common/cssjs.html'); %>
</head>

<body class="hold-transition sidebar-mini">
  <div class="wrapper"> 


      <!-- Default box -->
      <div class="card card-primary">
          <div class="card-header">
            <h3 class="card-title">文章列表</h3>
          </div>
          <div class="card-body p-0">
            <form action="" method="get">
              <input type="hidden" name="callback" value="<%=callback%>">
              <table class="table table-bordered">
                <tr>
                  <td>
                    <div class="input-group mb-3">
                      <div class="input-group-prepend">
                        <span class="input-group-text">ID</span>
                      </div>
                      <input type="text" name="itemid" class="" placeholder="" value="<%=itemid%>">
                      &nbsp;
                      <div class="input-group-prepend">
                          <span class="input-group-text">所属分类</span>
                        </div>
                        <%-category%>
                        &nbsp;
                      <div class="input-group-prepend">
                        <span class="input-group-text">标题</span>
                      </div>
                      <input type="text" name="title" class="" placeholder="" value="<%=title%>">
                      &nbsp;
                      <div class="input-group-prepend">
                        <span class="input-group-text">状态</span>
                      </div>
                      <select class="" name="flag">
                          <option value="0">请选择</option>
                          <% for(var k in CORE_ENUMS.flag){ let v=CORE_ENUMS.flag[k]; %>
                          <option value="<%=k%>" <% if(flag==k){ %>selected<% } %>><%=v%></option>
                          <% } %>
                      </select>
                      &nbsp;
                      
                      <button name="submit" type="submit" class="btn btn-primary">搜索</button>
                      &nbsp;
                      <button type="button" class="btn btn-warning" onclick="location.href='/article/outside?callback=<%=callback%>';">重置</button>
                    </div>

                  </td>
                </tr>
              </table>
            </form>
            
            <table class="table table-bordered">
              <% if(data.length){ %>
              <thead>
                <tr>
                  <th>ID</th>
                  <th>所属分类</th>
                  <th>标题</th>
                  <th>添加人</th>
                  <th>添加时间</th>
                  <th>显隐</th>
                </tr>
              </thead>
              <tbody>
                <% data.forEach(function(v,k){ %>
                <tr>
                  <td><%=v.itemid%></td>
                  <td><%-v.cat.cat_pos%></td>
                  <td><a href="javascript:my_click(<%=JSON.stringify(v)%>);"><%=v.title%></a></td>
                  <td><%=v.username%></td>
                  <td><%=v.addtime%></td>
                  <td><%=functions.myswitch(v.flag,CORE_ENUMS.flag)%></td>
                </tr>
                <% }) %>
                <tr>
                  <td colspan="100">
                    <%-pager%>
                  </td>
                </tr>
                <% }else{ %>
                <tr>
                  <td colspan="100">暂无数据</td>
                </tr>
                <% } %>
              </tbody>
            </table>
          </div>
          <!-- /.card-body -->
        </div>
        <!-- /.card -->

  
  </div>
  <script>
    function my_click(arr){
      parent.<%=callback%>(arr);	
    }
  </script>
</body>

</html>